<?php

namespace App\Admin\Validate;

use App\Common\Validate\Validate;

class GroupValidate extends Validate
{
    public function add($request)
    {
        $method     = $request->getMethod();
        if ($method=='POST'){
            $post       = $request->post();
            $rules      = [
                'title'       => 'required',
            ];
            $messages   = [
                'title.required'       => '组名必填',
            ];
            $attributes = [];
            if ($rules) {
                return $this->check($post, $rules, $messages, $attributes);
            }
        }
    }

    public function edit($request)
    {
        $method     = $request->getMethod();
        if ($method=='POST'){
            $post       = $request->post();
            $rules      = [
                'id'       => 'required',
                'title'       => 'required',
            ];
            $messages   = [
                'id.required'       => '缺少必要参数',
                'title.required'       => '组名必填',
            ];
            $attributes = [];
            if ($rules) {
                return $this->check($post, $rules, $messages, $attributes);
            }
        }
    }


}